from common.Ultils import BlogDriver
from selenium.webdriver.common.by import By
# from selenium.webdriver.support.ui import WebDriverWait
# from selenium.webdriver.support import expected_conditions as EC

class BlogExit:
    driver = ""
    url=""
    def __init__(self):
        url = "http://8.137.19.140:9090/blog_list.html"
        self.driver = BlogDriver.driver
        self.driver.get(url)

    def BlogExitByLogin(self):
        self.driver.find_element(By.CSS_SELECTOR,"body > div.nav > a:nth-child(6)").click()
        self.driver.implicitly_wait(2)

        #进行截屏操作
        BlogDriver.getScreeShot()

        #对于页面关键元素进行检查
        username = self.driver.find_element(By.CSS_SELECTOR, "#username").text
        password = self.driver.find_element(By.CSS_SELECTOR, "#password").text
        assert username == "" and password == ""
